Programming the UFL

After sketching out a new function, deciding on its parameters and data types, and determining the type of data the function will return to a report, you can begin programming the UFL.

A UFL is like any other DLL with a few simple differences:

You can design your UFL from scratch, but you may find the Helper Modules, provided with Crystal Reports useful. If you use the helper modules provided, you will only need to create a single C code module, a Module Definition (.def) File, and an application project file. More experienced programmers may want to use these modules simply as a starting point to design more complex UFL features.

The "Picture" example

Code for the Picture function is provided as an example of a UFL. The purpose of this function is to display string type field data using a format specified by the user. For example, if the phone number is entered in the database table as "4155551234", the user can create the following formula:

Picture({table.PHONENUM}, "(xxx) xxx-xxxx")

The phone number will appear in the report as: (415) 555-1234

The code segments that appear in this section as examples use this Picture function. In addition, the complete code is listed in Picture Function - a sample UFL function, later in the chapter.



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com